//
//  UIView+GradientBackground.m
//  Documents
//
//  Created by Alex Di Mango 
//  Copyright (c) 2012 Whardoo.com -  All rights reserved.
//

#import <QuartzCore/QuartzCore.h>
#import "UIView+GradientBackground.h"
#import "DocumentsColors.h"

@implementation UIView (GradientBackground)

- (void)removeBackgroundGradient
{
    [[self.layer.sublayers objectAtIndex:0] removeFromSuperlayer];
}

- (void)addBackgroundGradientWithColors:(NSArray *)colors
{
    [colors retain];
    CAGradientLayer *gradient = [CAGradientLayer layer];
    gradient.frame = self.bounds;
    gradient.colors = colors;
    gradient.cornerRadius = self.layer.cornerRadius;
    [self.layer insertSublayer:gradient atIndex:0];
    [colors release];
}

@end
